/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.gatech.gellinservlet.model;

import java.util.ArrayList;
import java.io.Serializable;

/**
 *
 * @author Tyler Powell
 */
public class Lab implements IDable , Serializable
{
    public static final int NOTEAM = 0;
    public static final int RANDOMTEAM = 1;
    public static final int PICKTEAM = 2;
    
    private static int totalLabs = 0;
    
    private String name;
    private int teamMaxSize;
    private int ID;
    
    private String startDate;
    private String startTime;
    private String endDate;
    private String endTime;
    
    private int courseID;
    
    //TODO figure out a way to setup start and end times effectively
    
    //TODO decide on what ints represent different types of designation
    private int teamDesignation;
    private ArrayList<Team> teamList;
    private ArrayList<Student> teamlessStudents;
    
    public Lab(String name, int teamMaxSize, int teamDesignation, int courseID, ArrayList<Student> teamlessStudents)
    {
        this.name = name;
        this.teamMaxSize = teamMaxSize;
        this.teamDesignation = teamDesignation;
        totalLabs++;
        ID = totalLabs;
        this.courseID = courseID;
        //TODO make this look pretty
        this.teamlessStudents = teamlessStudents;
        this.teamList = new ArrayList<Team>();
    }
    
    public ArrayList<Student> getTeamlessStudents()
    {
        return teamlessStudents;
    } 
    /**
     * Creates a new team and adds it to the lab's team list
     * @param name The name of the new team.
     * //TODO this method needs to needs to be changed/fixed!!
     */
    public void addTeam(Team aTeam)
    {
        if(teamDesignation != Lab.NOTEAM)
        {
            teamList.add(aTeam);
        }
    }
    
    public void removeTeam(Team aTeam)
    {
        teamList.remove(aTeam);
    }
    
    public String toString()
    {
        return name;
    }
    
    public int compareTo(Object o)
    {
        return toString().compareTo(((Lab)o).toString());
    }

    public String getEndDate()
    {
        return endDate;
    }

    public String getEndTime()
    {
        return endTime;
    }

    public String getStartDate()
    {
        return startDate;
    }

    public String getStartTime()
    {
        return startTime;
    }
    
    @Override
    public int getID()
    {
        return ID;
    }
    
    public int getTeamMaxSize()
    {
        return teamMaxSize;
    }
    
    public int getCourseID()
    {
        return courseID;
    }
    
    public int getTeamDesignation()
    {
        return teamDesignation;
    }

    public String getName()
    {
        return name;
    }

    public ArrayList<Team> getTeamList()
    {
        return teamList;
    }

    public static int getTotalLabs()
    {
        return totalLabs;
    }

    public static void setTotalLabs(int totalLabs)
    {
        Lab.totalLabs = totalLabs;
    }

    public void setEndDate(String endDate)
    {
        this.endDate = endDate;
    }

    public void setEndTime(String endTime)
    {
        this.endTime = endTime;
    }

    public void setStartDate(String startDate)
    {
        this.startDate = startDate;
    }

    public void setStartTime(String startTime)
    {
        this.startTime = startTime;
    }
    
    

}
